using Acme.BookStore.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Acme.BookStore.EntityFrameworkCore.Configurations
{
    public class RfidConfiguration : IEntityTypeConfiguration<Rfid>
    {
        public void Configure(EntityTypeBuilder<Rfid> builder)
        {
            builder.ToTable("RFIDTable");

            builder.HasKey(x => x.Id);
            
            builder.Property(x => x.Id)
                .HasColumnName("business_number")
                .IsRequired()
                .HasColumnType("text");

            builder.Property(x => x.Rfid1)
                .HasColumnName("rfid1")
                .HasMaxLength(50);

            builder.Property(x => x.CreationDate)
                .HasColumnName("creation_date")
                .IsRequired();

            builder.Property(x => x.CreatorLoginName)
                .HasColumnName("creator_login_name")
                .HasMaxLength(50);

            builder.Property(x => x.Type)
                .HasColumnName("type")
                .HasMaxLength(20);

            builder.Property(x => x.BusinessContent)
                .HasColumnName("business_content")
                .HasColumnType("text");

            builder.Property(x => x.Rfid2)
                .HasColumnName("rfid2")
                .HasMaxLength(50);
                
            builder.Property(x => x.Rfid3)
                .HasColumnName("rfid3")
                .HasMaxLength(50);
        }
    }
} 